/*
 * @Author: your name
 * @Date: 2022-02-17 13:06:58
 * @LastEditTime: 2022-02-17 16:07:14
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \my-site\src\utils\bounce.js
 */
/*
    @imput = function(){

    }
*/

/*
    Observe构造函数 递归对象 变成响应式对象
*/
// 防抖
export default function debounce(fn, that, delay=1000) {
            console.log(that)
            let timer = null //借助闭包
            return function () {
                if (timer) {
                    clearTimeout(timer)
                }
                window.setTimeout(() => {
                    fn.call(that)
                }, delay) // 简化写法
            }
        }